When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.
To mitigate this potential impact, the following changes are
implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
drivers that support both statically declared devices and
configuration from device tree
Signed-off-by: Bin Meng <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
.platdata_auto_alloc_size = sizeof(struct atftmr_timer_platdata),
.probe = atftmr_timer_probe,
.ops = &ag101p_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.platdata_auto_alloc_size = sizeof(struct altera_timer_platdata),
.probe = altera_timer_probe,
.ops = &altera_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.of_match = arc_timer_ids,
.probe = arc_timer_probe,
.ops = &arc_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
.priv_auto_alloc_size = sizeof(struct arc_timer_priv),
};
.priv_auto_alloc_size = sizeof(struct ast_timer_priv),
.ofdata_to_platdata = ast_timer_ofdata_to_platdata,
.ops = &ast_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.platdata_auto_alloc_size = sizeof(struct atcpit_timer_platdata),
.probe = atcpit_timer_probe,
.ops = &atcpit_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.platdata_auto_alloc_size = sizeof(struct atmel_pit_platdata),
.probe = atmel_pit_probe,
.ops = &atmel_pit_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.priv_auto_alloc_size = sizeof(struct cadence_ttc_priv),
.probe = cadence_ttc_probe,
.ops = &cadence_ttc_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.id = UCLASS_TIMER,
.ops = &dw_apb_timer_ops,
.probe = dw_apb_timer_probe,
- .flags = DM_FLAG_PRE_RELOC,
.of_match = dw_apb_timer_ids,
.ofdata_to_platdata = dw_apb_timer_ofdata_to_platdata,
.priv_auto_alloc_size = sizeof(struct dw_apb_timer_priv),
.of_match = mpc83xx_timer_ids,
.probe = mpc83xx_timer_probe,
.ops = &mpc83xx_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
.priv_auto_alloc_size = sizeof(struct mpc83xx_timer_priv),
};
.priv_auto_alloc_size = sizeof(struct omap_timer_priv),
.probe = omap_timer_probe,
.ops = &omap_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.of_match = rockchip_timer_ids,
.probe = rockchip_timer_probe,
.ops = &rockchip_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
.priv_auto_alloc_size = sizeof(struct rockchip_timer_priv),
#if CONFIG_IS_ENABLED(OF_PLATDATA)
.platdata_auto_alloc_size = sizeof(struct rockchip_timer_plat),
.priv_auto_alloc_size = sizeof(struct sti_timer_priv),
.probe = sti_timer_probe,
.ops = &sti_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.priv_auto_alloc_size = sizeof(struct stm32_timer_priv),
.probe = stm32_timer_probe,
.ops = &stm32_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
.of_match = tsc_timer_ids,
.probe = tsc_timer_probe,
.ops = &tsc_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};